﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace AbingtonBooks.Pages.Register
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            using (dbAbingtonBooks context = new dbAbingtonBooks()) {
                Customer myCustomer = new Customer();
                myCustomer.FirstName = txtFname.Text;
                myCustomer.LastName = txtLname.Text;
                myCustomer.Address = txtStreet.Text;
                myCustomer.City = txtCity.Text;
                myCustomer.State = txtState.Text.ToUpper();
                myCustomer.ZipCode = txtZip.Text;
                myCustomer.Email = txtEmail1.Text;
                myCustomer.Username = txtUser.Text;
                myCustomer.Password = txtPassword.Text;
                context.Customers.Add(myCustomer);
                context.SaveChanges();
            }
            Response.Redirect("~/Default.aspx");
        }
    }
}